/*
This is an example script for a line. Click the Execute button to apply and then execute this script. Upon each execution the line alters its appearance. Turn on animation to execute periodically.
*/

/* Declaration blocks */

double cos(double a);
double sin(double a);

@@class() Line:Object

@@method(public, class) (id)stored;
@@method(public, instance) (unsigned)animationCount;
@@method(public, instance) (void)sizeToCenteredWidth:(double)width height:(double)height;
@@method(public, instance) (void)moveCenterToXValue:(double)xValue yValue:(double)yValue;
@@method(public, instance) (void)setCurveRed:(double)red green:(double)green blue:(double)blue alpha:(double)alpha;

@@end

/* Execution block */

{
id myLine;
unsigned animationCount;
double radius, width, height;
double xValue, yValue;
double red, green, blue;

myLine = [Line stored];

animationCount = [myLine animationCount];

radius = 80.0 + 50.0 * cos(animationCount * 0.15 + 0.1);
width = 2.0 * radius;
height = 2.0 * radius;

xValue = 180.0 + 50.0 * cos(animationCount * 0.15 + 0.1);
yValue = 290.0 + 80.0 * sin(animationCount * 0.15 + 0.1);

red = cos(animationCount * 0.1);
green = 0.5;
blue = 0.5;

[myLine moveCenterToXValue:xValue yValue:yValue];
[myLine sizeToCenteredWidth:width height:height];
[myLine setCurveRed:red green:green blue:blue alpha:1.0];

}
